<?php

require "include/bittorrent.php";
dbconn();
loggedinorreturn();
if ($CURUSER["class"] < UC_MODERATOR && $CURUSER['id'] != $betsadmin)
	stderr("错误", "权限不足");
$HTMLOUT = "";
$HTMLOUT .="<a href='bet.php'><img src='betting.png' alt='Bet' title='博彩' width='400' height='125' /></a>
<h1>竞猜管理</h1>
<table class='main' width='200' cellspacing='0' cellpadding='5' border='0'>
<tr>
<td align='center' class='navigations'><a href='bet_admin.php'>添加竞猜</a></td>
<td align='center' class='navigations'><a href='bet_gamefinish.php'><font color='red'>结束竞猜</font></a></td>
</tr>
</table>
<br />";
$HTMLOUT .="<h1>！警告！<br /> 点击获胜选项将会发放奖金 !<br />！警告！</h1>";
$end = time();
$active = sql_query("SELECT * FROM betgames WHERE active = 0 AND endtime <" . sqlesc($end) . "") or sqlerr(__FILE__, __LINE__);
while ($active1 = mysql_fetch_assoc($active)) {
	$HTMLOUT .="<table><tr><td><b>" . htmlspecialchars($active1['heading']) . "</b>的结果是</td>";
	$a = sql_query("SELECT * FROM betoptions WHERE gameid =" . sqlesc($active1["id"]) . " ORDER BY id ASC") or sqlerr(__FILE__, __LINE__);
	while ($b = mysql_fetch_assoc($a)) {
		$HTMLOUT .="<td><a href='bet_gamefinish2.php?id=" . $b['id'] . "'>" . htmlspecialchars($b['text']) . "</a> (" . htmlspecialchars($b['odds']) . ")</td>";
	}
	$HTMLOUT .='</tr></table>';
}
stdhead('博彩');
print $HTMLOUT;
stdfoot();
